#include "HeaderParameters.hh"
#include <fstream>
#include <iostream>
#include <stdlib.h>

using std::ifstream;
using std::cout;
using std::endl;
using std::cin;

HeaderParameters::HeaderParameters(string fname, int channels)
 :filename(fname)
{

  cout << "OPENING HEADERFILE: " << filename << endl;
	my_channels=channels;
  ifstream headerfile(filename.c_str(), ifstream::in);
  char rbuf[256];				
 
  for(int channel=0; channel<my_channels; channel++)
  {
    for(int i = 0;i<8;i++)
	{
        headerfile >> rbuf;
        par[channel][i] = atof(rbuf);
		if(headerfile.eof()==true) break;
    } 
  
 //   time_per_div = par[channel][5];
 //   num_traces = int(par[channel][7]); 
  }
    headerfile.close();
}

HeaderParameters::~HeaderParameters(){

 

}


void HeaderParameters::PrintParameters(){
  
  cout << "----HEADER PARAMETERS----" << endl;
  for(int channel=0; channel<my_channels; channel++)
  {
    cout << "Channel: " << channel << endl;
    for (int i=0; i<8; i++){
      cout << "  "  << par[channel][i] << endl;
    }
  }
  cout << "-------------------------" << endl;

};
